package speedball;

import javafx.scene.paint.Color;
import javafx.scene.paint.CycleMethod;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Paint;
import javafx.scene.paint.Stop;
import javafx.scene.shape.Shape;

public class EffectManage {

	public static void colorLinearGradient(Shape shape, Color startColor, Color endColor, Direction direction) {
		Stop[] stops = new Stop[] { new Stop(0, startColor), new Stop(1, endColor) };
		LinearGradient shadow = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
		shape.setFill(shadow);
	}

	public static Paint colorLinearGradient(Color startColor, Color endColor, Direction direction) {

//		right.setStyle("-fx-effect: dropshadow(three-pass-box, #72b9da, 5.0,0, 0, 0);");
		Stop[] stops = new Stop[] { new Stop(0, startColor), new Stop(1, endColor) };
		LinearGradient shadow;
		if (direction == Direction.TURN_UP) {
			shadow = new LinearGradient(0, 1, 0, 0, true, CycleMethod.NO_CYCLE, stops);
		} else if (direction == Direction.TURN_DWON) {
			shadow = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
		} else if (direction == Direction.TURN_LEFT) {
			shadow = new LinearGradient(1, 0, 0, 0, true, CycleMethod.NO_CYCLE, stops);
		} else if(direction == Direction.TURN_RIGHT){
			shadow = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
		}else if(direction == Direction.TURN_UP_LEFT||direction ==Direction.TURN_LEFT_UP) {
			shadow = new LinearGradient(1, 1, 0, 0, true, CycleMethod.NO_CYCLE, stops);
		}else if(direction == Direction.TURN_UP_RIGHT||direction ==Direction.TURN_RIGHT_UP) {
			shadow = new LinearGradient(0, 1, 1, 0, true, CycleMethod.NO_CYCLE, stops);
		}else if(direction == Direction.TURN_DOWN_LEFT||direction ==Direction.TURN_LEFT_DOWN) {
			shadow = new LinearGradient(1, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
		}else {
			shadow = new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, stops);
		}
		return shadow;
	}

	public static void createShadow(Shape shape, String color) {
//		one-pass-box, two-pass-box, three-pass-box, gaussian
		//-fx-effect: dropshadow(three-pass-box, #72b9da, 5.0,0, 0, 0);
//		color.val
		Color.valueOf("#009688");
		//"-fx-effect: dropshadow(three-pass-box, #72b9da, 5.0,0, 0, 0);
		StringBuilder stringBuilder=new StringBuilder("-fx-effect: dropshadow(three-pass-box, ");
		stringBuilder.append(color);
		stringBuilder.append(", 5.0,0, 0, 0);");
//		color.valueOf
		shape.setStyle(stringBuilder.toString());

	}

	public static Paint createShadow(Color startColor, Color endColor, Direction direction) {

		return null;

	}

//	ColorLinearGradient

	enum Direction {
		TURN_UP, TURN_DWON, TURN_LEFT, TURN_RIGHT,
		TURN_UP_LEFT, TURN_UP_RIGHT, TURN_DOWN_LEFT, TURN_DOWN_RIGHT,
		TURN_LEFT_UP, TURN_RIGHT_UP, TURN_LEFT_DOWN, TURN_RIGHT_DOWN;
		
	}

	enum JavaFxConstants{
		HORIZONTAL,VERTICAL;
	}



}
